<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <base href="<%=request.getContextPath()%>/"/>
    <title>登录页</title>

    <!-- BOOTSTRAP STYLES-->

    <link href="assets/css/bootstrap.css" rel="stylesheet" />
    <!-- FONTAWESOME STYLES-->
    <link href="assets/css/font-awesome.css" rel="stylesheet" />

    <!-- GOOGLE FONTS-->
    <link href='assets/fonts/googleapis.css' rel='stylesheet' type='text/css' />

    <script src="assets/js/jquery-1.10.2.js"></script>

    <link href="assets/bootstrap-toastr/toastr.min.css" rel="stylesheet" />
    <script src="assets/bootstrap-toastr/toastr.min.js"></script>
    <script type="text/javascript" src="assets/hu-admin/static/h-ui.admin/project/global.js"></script>
</head>
<body style="background-color: #ECEFF1;">

<style type="text/css">
    .loginStyle{border-radius: 6px;-webkit-border-radius: 6px;-moz-border-radius: 6px; background: #FFF;box-shadow: 0 0 10px #BFBFBF;-webkit-box-shadow: 0 0 10px #BFBFBF;-moz-box-shadow: 0 0 10px #BFBFBF;-o-box-shadow: 0 0 10px #BFBFBF;}
    .width100{width: 100%}
    .forgetLogin,.thirdLogin{width: 100%;padding:10px 0;}
    .forgetLogin span{width:50%;float:left;font-size: 12px;line-height: 30px;font-weight: normal; color: #B7B7B7;}
    .forgetLogin span input{ float: left;margin-top: 10px;}
    .forgetLogin span:last-child{float:right;text-align: center;color: #428bca;font-weight: normal;}
    .forgetLogin span:last-child a{width: 48%;text-align: center;}
    .thirdLogin{position: relative;top:-41px}
    .thirdLogin .label1{width: 40%;float: left;display: block;text-align: center;font-weight: normal;color: #666;background: #FFF;margin-left: 30%}
    .thirdLogin span{width: 100%;display: block;float: left;text-align: center;padding: 20px 0 0 0;}
    .thirdLogin span img{padding: 0 10px;}
</style>
<div class="container">
    <div class="row text-center " style="padding-top:200px;">
        <div class="col-md-12">
            <img src="assets/img/logo-invoice.png" />
        </div>
    </div>
    <div class="row ">

        <div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1 loginStyle" >

            <div class="panel-body">
                <form id="loginForm" role="form" action="system/user/login">

                    <br />
                    <label>请输入工号</label>
                    <div class="form-group input-group">
                        <span class="input-group-addon"><i class="fa fa-tag"  ></i></span>
                        <input type="text" name="code" class="form-control" placeholder="用户名 " />
                    </div>
                    <label>请输入密码</label>
                    <div class="form-group input-group">
                        <span class="input-group-addon"><i class="fa fa-lock"  ></i></span>
                        <input type="password" name="passwd" class="form-control"  placeholder="密码" />
                    </div>
                    <a href="javascript:void(0);" id="submitLogin" class="btn btn-primary width100 " style="margin-top: 20px;">登录</a>

                    <%--<label class="forgetLogin">--%>
                        <%--<span><input type="checkbox" value="保存登陆信息">在电脑上保存登陆</span>--%>
                        <%--<span><a href="#">忘记密码</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#">新用户注册</a> </span>--%>
                    <%--</label>--%>
                    <hr />
                    <%--<div class="thirdLogin">--%>
                        <%--<label class="label1">第三方登录</label>--%>
                        <%--<span>--%>
                            <%--<label><img src="assets/img/wx-icon.png" /></label>--%>
                            <%--<label><img src="assets/img/QQ-icon.png" /></label>--%>
                        <%--</span>--%>
                    <%--</div>--%>
                </form>
            </div>

        </div>


    </div>
</div>

</body>

<script>

    if(window.parent.document.getElementById('Hui-skin')){
        window.parent.document.location.href=WEBLoginUrl+'/system/user/login.htm';
        console.log('有父级');

    }
    else{
        console.log('没有父级');
      //  window.location.href='https://www.baidu.com/'
    }

    $(document).ready(function () {
        var submitLogin=function () {
            var formParam=$("#loginForm").serializeArray()||[];
            var param={};
            formParam.map(function(f){
                return param[f.name]=f.value;

            });
//            formParam.map(f=>{
//                param[f.name]=f.value;
//            });
            $.ajax({
                url:"system/user/login",
                type:'post',
                data:param
            }).done(function (result) {
                if(result.code == '0000'){
                   // window.location.href="system/user/home.htm";
                    sessionStorage.userCode = $("#loginForm  input[name=code]").val();
                    window.location.href="/backend/static/index.html";
                }else if(result.code == '0004'){
                    toastr.error('未知用户');
                }else{
                    toastr.error(result.msg);
                }
            }).fail(function (result) {
                toastr.error('服务器异常:'+result.statusText);

            });
        };
        $("#submitLogin").click(submitLogin);
        $(document.body).bind('keyup',function (event) {
            if(event.key=='Enter'){
                submitLogin();
            }
        })
    })


</script>
</html>
